package login;

import java.awt.Panel;

import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;

import java.awt.Color;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;
	  
	   class UT extends JFrame implements ActionListener {
		   static ActionListener listener;
        private static JButton a=new JButton("ACCEDI");
        private static JButton r=new JButton ("REGISTRATI");
	    
	     ImagePanell panel = new ImagePanell(new ImageIcon("C:\\Users\\acer\\workspace1\\EsameLDAlgoritmi\\src\\Images\\image-1.jpg").getImage());
         
		    
	     public UT() {
	    	   JDialog frame = new JDialog();
		       frame.setTitle("LOGIN");
		       panel.add(a);
		        panel.add(r);
		       frame.getContentPane().add(panel);
		       frame.pack();
		       frame.setVisible(true);
		       frame.setLocation(200,100);
		       a.setBounds(700,150, 200, 100);
		       a.setBorder(null);
		        a.addActionListener( listener);
		        a.setFont(new Font("Impact",Font.TRUETYPE_FONT,16));
		        a.setForeground(new java.awt.Color(14,5,100));
		        a.setBackground(new java.awt.Color(0,100,255));
		        //registrati button
		        r.setBounds(700,300,200,100);
			     r.setBorder(null);
			        r.addActionListener( listener);
			        r.setFont(new Font("Impact",Font.TRUETYPE_FONT,16));
			      r.setForeground(new java.awt.Color(14,5,100));
		        r.setBackground(new java.awt.Color(0,100,255));
	     }
	     public static void main(String[] args) {
		      UT uni=new UT();
		     }
	    
		@Override
		public void actionPerformed(ActionEvent ae) {
			if( ae.getSource()==a){
				 
						SwingUtilities.invokeLater(new Runnable() {

							@Override
							public void run() {
								MioLogin inst = new MioLogin();
								inst.setLocationRelativeTo(null);
								inst.setVisible(true);
								inst.setVisible(false);
								
								
							}
							
						});
			}
			if(ae.getSource()==r){
				SwingUtilities.invokeLater(new Runnable() {

					@Override
					public void run() {
						Registrazione inst = new Registrazione();
						inst.setLocationRelativeTo(null);
						inst.setVisible(true);
						inst.setVisible(false);
						
						
					}
					
				});
			}
			
		} 


	  
  }

